<?php
#单文件上传
header('content-type:text/html;charset=utf-8');
date_default_timezone_set('UTC');//date时间报错的处理


#接收表单上传的文件
$obj = $_FILES['fobj'];#数组

#获取扩展名
 // print_r($obj['tmp_name']);exit;

for ($i=0; $i < count($obj['tmp_name']); $i++) { 
    $pos = strpos($obj['name'][$i], '.');
    $ext = strtolower(substr($obj['name'][$i], $pos+1));
    $dir =  'uploads/'.date('Ymdhis').$i.'.'.$ext;
    $result = move_uploaded_file($obj['tmp_name'][$i],$dir);
    if($result == true)
    {
        echo "上传".$obj['name'][$i]."成功！";
    }
    else
    {
        echo "上传失败！";
    }
}



?>
